﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Common;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace AISservice
{
    public class Program
    {
        public static void Main(string[] args)
        {
            try
            {
                Log4Net.Info("begining to dostart.");
                RoutingService.LoadAction();
                Log4Net.Info("Registed All Handler.");
                Console.WriteLine("Registed All Handler");
            }
            catch (Exception ex)
            {
                Log4Net.Error("error while start", ex);
            }
            
            CreateWebHostBuilder(args).Build().Run();
        }

        /// <summary>
        /// Test port 8081  produce port 8010
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args).UseConfiguration(new ConfigurationBuilder().AddCommandLine(args).Build())
                            .UseStartup<Startup>();
    }
}
